<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"> </script>
</head>
<body>
  <div id="app1">
    <h1>实例1</h1>
    <button @click="changeName">changeName</button>
    <son :name="name" age="17"></son>
  </div>

  <!-- fa -->
   <template id="son">
    <div>
      <h1>这里是son1组件</h1>
      {{ name }}
    </div>
   </template>

  <script>
   
    
    Vue.component("son",{
      template: '#son',
      // props: ['name'],
      // props: { name: String }
      // props: {
      //   name: {
      //     // required: false,
      //     type: String,
      //     default: "呵呵哒"
      //   }
      // }
      props: {
        name: String,
        age: {
          validator(val) {
            console.log(val)
            return val > 16
          }
        }
      }
    })

    new Vue({
      el: "#app1", 
      data: {
        name: '韩梅梅'
      },
      methods: {
        changeName() {
          this.name = "李雷雷"
        }
      }
    })

    /*

    */


  </script>
</body>
</html>